package work1;

public class Yichang {
	public final static int x1 = 5000;
	public final static int x2 = 10000;

	public static double avg(double Y) throws Exception {
		if (Y > x1) {
			Y = Y * 0.95;
		}
		if (Y > x2) {
			Y = Y * 0.9;
		}
		if (Y < x1) {
			Y = Y;
		}
		return Y;
	}

	public static double sum(double num1, double num2) throws Exception {
		if (num1 < 0 || num2 < 0) {
			throw new Exception("收入必须为正数");
		}
		return (num1 + num2);
	}
}
